package cn.leftsite.test.mockito;

/**
 * @author wangjinqiang
 * @date 2019-06-11
 */
public class PersonService {
    private final PersonDao personDao;

    public PersonService(PersonDao personDao) {
        this.personDao = personDao;
    }

    public boolean update (int id, String name){
        Person person = personDao.getPerson(id);
        if (person == null) {
            return false;
        }
        Person personUpdate = new Person(id, name);
        return personDao.update(personUpdate);
    }
}
